<form action="" method="post" enctype="multipart/form-data">
<table width="200" border="1">
  <tr>
    <th colspan="3">Đăng tin</th>
  </tr>
  <tr>
    <td>Title</td>
    <td>Content</td>
    <td>Sourse</td>
  </tr>
  <tr>
    <td>&nbsp;<input type="text" name="tieude"/></td>
    <td>&nbsp;<input type="text" name="noidung"/></td>
    <td>&nbsp;<input type="file" name="anh"/></td>
  </tr>
  <tr>
    <th colspan="3">&nbsp;<input value="Post!" type="submit" name="dangtin"/></th>
    </tr>
</table>

</form>
<?php
	if(isset($_POST['dangtin'])){
		$td=$_POST['tieude'];
		$nd=$_POST['noidung'];
		$anh=$_FILES['anh']['name'];
		$link='upload/'.$anh;
		copy($_FILES['anh']['tmp_name'],$link);
		$q="insert into tintuc(Tieude,Noidung,anh1) values('$td','$nd','$link')";
		$r=mysqli_query($dbc,$q) or die(mysqli_error($dbc));
		if(mysqli_affected_rows($dbc)){
			echo "OK";
		}
	}
	
?>